home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / HotKeys / HotKeys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-29  |  1.4 KB  |  73 lines  |  [TEXT/KAHL]

  1. /*
  2.  *    File:        HotKeys.h
  3.  *
  4.  *    Abstract:    Interface to the HotKeys library
  5.  *
  6.  *    Uses:        HotKeys.c, HotKeys.rsrc, MacTraps
  7.  *
  8.  *    Licensing:    This code may be used without fees provided that proper
  9.  *                copyright notice given.
  10.  *
  11.  *    History:    1.0.0    RSM        93-11-29    Created first version
  12.  *
  13.  *    ©1993 One Step Beyond
  14.  */
  15.  
  16. #pragma once
  17. #ifndef __HOTKEYS__
  18. #define __HOTKEYS__
  19.  
  20. #ifndef __TYPES__
  21. #include <Types.h>
  22. #endif
  23.  
  24.  
  25. typedef struct{
  26.     char            onOff;        // if 1, hot key is active, 0 it is inactive
  27.     char            filler;        // unused
  28.     unsigned char    mods;        // modifier flags, shifted 8 from event record mods
  29.     unsigned char    keyCode;    // the virtual keycode
  30. }HotKey;
  31.  
  32.  
  33. extern short gHotKeySICNRsrcID;        // change these to whatever you want
  34. extern short gHotKeyDLOGRsrcID;
  35. extern short gHotKeyStrsRsrcID;
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41.  
  42. // Return 1 if the msg & mods match the given hotkey, 0 otherwise
  43.  
  44. short IsHotKey( const HotKey*, const long msg, const short mods );
  45.  
  46.  
  47. // Set the given hotkey given the msg and mods
  48.  
  49. void SetHotKey( HotKey*, const long msg, const short mods );
  50.  
  51.  
  52. // Unsets a hot key to nothing.
  53.  
  54. void ClearHotKey( HotKey* );
  55.  
  56.  
  57. // Allows user to set the hot key using a "modal" dialog.
  58.  
  59. void SetHotKeyDlog( HotKey* );
  60.  
  61.  
  62. //    Draw the hot key's representation in the current port.
  63. //    Note: this uses's the port's current font, size, face and colors
  64.  
  65. OSErr DrawHotKey( const HotKey*, const Rect* );
  66.  
  67.  
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71.  
  72. #endif
  73.